import { storesKey } from "~/constants/stores";

interface CounterState {
	deviceType: number;
}
export const useAppStore = defineStore(storesKey.app, {
	state: (): CounterState => ({
		deviceType: 1 // 1: pc,2: pad, 3: mobile
	}),
	actions: {
		setDeviceType(val: number) {
			this.deviceType = val;
		}
	},

	//persist定义要做判断，因为localStorage是客户端参数，所以需要加process.client
	persist: import.meta.client && {
		storage: localStorage,
		paths: ["deviceType"]
	}
});
